package com.ansuenjob.jsonBuilder;

import org.json.JSONException;
import org.json.JSONObject;

import com.ansuenjob.model.Company;
import com.ansuenjob.model.Job;
import com.ansuenjob.model.JobInterview;
import com.ansuenjob.vo.InterviewRecordVO;
import com.ansuenjob.vo.JobVO;

public class InterviewVoBuilder extends JSONBuilde<InterviewRecordVO>{

	@Override
	public InterviewRecordVO buildJson(JSONObject jsonObject) throws JSONException {
		InterviewCompanyBuilder comBuilder = new InterviewCompanyBuilder();
		InterviewJobBuilder jobBuilder = new InterviewJobBuilder();	
		InterviewListBuilder interviewListBuilder = new InterviewListBuilder();
		
		JSONObject jCompany = jsonObject.getJSONObject("bstCompanyAccount");
		JSONObject jJob	= jsonObject.getJSONObject("bstCompanyJob");
		JSONObject jList= jsonObject.getJSONObject("bstPersonInterview");
		Company company = comBuilder.buildJson(jCompany);
		Job job = jobBuilder.buildJson(jJob);
		JobInterview jobInterview = interviewListBuilder.buildJson(jList);
				
		InterviewRecordVO jobVo = new InterviewRecordVO(job, company,jobInterview);
		return jobVo;
	}

}
